#include <sys/time.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main() {
    const char* filepath;
    int fd;
    
    filepath = "./log";

    // open in read mode only
    // fd = open(filepath, O_RDONLY);

    // open in read write mode, create file if not exists
    fd = open(filepath, O_RDWR | O_CREAT | O_TRUNC, 0644);

    if (fd < 0) {
        perror("open");
        exit(1);
    }

    printf("open(filepath, O_RDWR | O_CREAT | O_TRUNC, 0644);\n", fd);

    close(fd);
    
    return 0;
}